package com.itheima.SingleInstanc2;

import java.util.Scanner;

public class TesD {
    public static void main(String[] args) {
        JD[] jds=new JD[3];
        jds[0]=new TV("电视", true);
        jds[1]=new Air("空调", false);
        jds[2]=new Lamp("冰箱", true);
        Smartcontrol sc=new Smartcontrol();
//        sc.control(jds[0]);
        sc.printALL(jds);
        System.out.println("请选择要控制的设备");
        Scanner sc1=new Scanner(System.in);
        String num=sc1.next();
        while(true){
        switch(num){
            case "1":
                sc.control(jds[0]);
                break;
            case "2":
                sc.control(jds[1]);
                break;
            case "3":
                sc.control(jds[2]);
                break;
            case "exit":
                System.out.println("退出");
                return;
            default:
                System.out.println("输入错误");
        }
        }
    }
}
